using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class FMS_StationDeliverFeeMap : EntityTypeConfiguration<FMS_StationDeliverFee>
	{
		public FMS_StationDeliverFeeMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.UpdateCode)
				.HasMaxLength(20);
				
			this.Property(t => t.AuditCode)
				.HasMaxLength(20);
				
			this.Property(t => t.Status)
				.IsFixedLength()
				.HasMaxLength(5);
				
			// Table & Column Mappings
			this.ToTable("FMS_StationDeliverFee");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.MerchantID).HasColumnName("MerchantID");
			this.Property(t => t.StationID).HasColumnName("StationID");
			this.Property(t => t.BasicDeliverFee).HasColumnName("BasicDeliverFee");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.UpdateCode).HasColumnName("UpdateCode");
			this.Property(t => t.AuditBy).HasColumnName("AuditBy");
			this.Property(t => t.AuditTime).HasColumnName("AuditTime");
			this.Property(t => t.AuditCode).HasColumnName("AuditCode");
			this.Property(t => t.AuditResult).HasColumnName("AuditResult");
			this.Property(t => t.Status).HasColumnName("Status");

			// Relationships
			this.HasRequired(t => t.MerchantBaseInfo)
				.WithMany(t => t.FMS_StationDeliverFee)
				.HasForeignKey(d => d.MerchantID);
				
		}
	}
}

